import { ResPage, User } from "@/api/interface/index";
import http from "@/api";

/**
 * @name 用户管理模块
 */
// 获取用户列表
export const getUserList = (params: User.ReqUserParams) => {
  return http.post<ResPage<User.ResUserList>>(`/sys/user/query`, params);
};

// 新增用户
export const addUser = (params: {}) => {
  return http.post(`/sys/user/add`, params);
};
// 编辑用户
export const editUser = (params: { userId: string }) => {
  return http.post(`/sys/user/modify`, params);
};

// 删除用户
export const deleteUser = (params: { userList: { userId: string }[] }) => {
  return http.post(`/sys/user/remove`, params);
};

// 切换用户状态
export const changeUserStatus = (params: { userId: string; status: number }) => {
  return http.post(`/sys/user/modifyStatus`, params);
};

// 重置用户密码
export const resetUserPassWord = (params: { userPasswd: string; userList: { userId: string }[] }) => {
  return http.post(`/sys/user/restPasswd`, params);
};
// 获取用户角色字典
export const getRoleTree = (params = {}) => {
  return http.post<User.ResRoleSelList>(`/sys/role/selection/query`, params);
};
//用户选择列表
export const getUserSelList = (params = {}) => {
  return http.post(`/sys/user/selection/query`, params);
};
